using SharpDX;
using System.Collections.Generic;
using System.Text;

namespace Scenario_Editor.Tools
{
    /// <summary>
    /// Stores the normal and Ids from the given polygons to a vertex.
    /// </summary>
    public class PolygonData
    {
        #region Private Fields

        private Vector3 normalFromAllPolys;
        private List<short> polygonIds;
        private short vertexID;

        #endregion Private Fields

        #region Public Constructors

        public PolygonData(short vertexID, short polygonID)
        {
            this.normalFromAllPolys = Vector3.Zero;
            this.vertexID = vertexID;
            this.polygonIds = new List<short>() { polygonID };
        }

        #endregion Public Constructors

        #region Public Properties

        /// <summary>
        /// The normal of the Polygon.
        /// </summary>
        public Vector3 Normal
        {
            get { return normalFromAllPolys; }
            set { normalFromAllPolys = value; }
        }

        /// <summary>
        /// A List of polygons which uses the stored vertex.
        /// </summary>
        public List<short> PolygonIds
        {
            get { return polygonIds; }
            set { polygonIds = value; }
        }

        /// <summary>
        /// the vertex Id
        /// </summary>
        public short VertexID
        {
            get { return vertexID; }
            set { vertexID = value; }
        }

        #endregion Public Properties

        #region Public Methods

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("(" + polygonIds.Count + "): ");
            foreach (var item in polygonIds.Count.ToString())
            {
                sb.Append(item + ", ");
            }
            return sb.ToString();
        }

        #endregion Public Methods
    }
}